package rs.ac.bg.etf.estudent.fragment;

import java.util.ArrayList;
import java.util.HashMap;

import rs.ac.bg.etf.estudent.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.SimpleAdapter;

public class EnrollmentFragment extends Fragment {
	
	
	
	private SimpleAdapter mTable;
	private ListView list;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View view = inflater.inflate(R.layout.fragment_enrollment, container, false);
		list = (ListView)view.findViewById(R.id.enroll_table);
		View headerView = inflater.inflate(R.layout.enroll_list_heder, null,false);
		list.addHeaderView(headerView);
		return view;
	}
	
	@Override
	public void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		
		ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("godina", "2009/10");
		map.put("godstd", "prva");
		map.put("status", "finansiranje iz budzeta");
		map.put("nacin", "standardno");
		map.put("profil", "Elektrotrehnika i racunarstvo");
		map.put("statut", "Statut iz 2006. godine");
		map.put("espbex", "");
		map.put("espb", "60");
		map.put("put", "1");
		
		mylist.add(map);
		map.put("godina", "2010/11");
		map.put("godstd", "druga");
		map.put("status", "finansiranje iz budzeta");
		map.put("nacin", "standardno");
		map.put("profil", "modul Racunarska tehnika i informatika");
		map.put("statut", "Statut iz 2006. godine");
		map.put("espbex", "");
		map.put("espb", "60");
		map.put("put", "1");
		mylist.add(map);
		// ...
		mTable = new SimpleAdapter(getActivity(), mylist, R.layout.enroll_list_item,
		            new String[] {"godina", "godstd","status","nacin","profil","statut","espbex","espb","put"}, new int[] {R.id.enroll_year, R.id.enroll_study_year,
									R.id.enroll_status,	R.id.enroll_method, R.id.enroll_profile,R.id.enroll_statute,R.id.enroll_espb_excp,
									R.id.enroll_espb,R.id.enroll_times});
		list.setAdapter(mTable);
	}

}
